package com.kevin.springboot.dao;

import com.kevin.springboot.pojo.DepartMent;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @Classname DepartMentDao
 * @Description TODO
 * @Date 2020/6/24 16:48
 * @Created by kevin
 */
public class DepartMentDao {

    //模拟数据库的信息

    private static Map<Integer, DepartMent> departMents = null;

    static {
        departMents = new HashMap<Integer, DepartMent>();
        departMents.put(101, new DepartMent(101, "教学部"));
        departMents.put(102, new DepartMent(102, "后勤部"));
        departMents.put(103, new DepartMent(103, "计算机部"));
        departMents.put(104, new DepartMent(104, "科学部"));
        departMents.put(105, new DepartMent(105, "管理部"));
    }

    /**
     * 获取所有的部门
     *
     * @return
     */
    public Collection<DepartMent> getDepartMent() {

        return departMents.values();
    }

    /**
     * 根据部门id获取部门信息
     *
     * @param id
     * @return
     */
    public DepartMent getDepartMentById(Integer id) {
        return departMents.get(id);
    }
}
